﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cloak.NUnit;
using NUnit.Framework;

namespace Cloak.Time
{
	public class CreateUtcTimeContext : Behavior
	{
		private DateTime _now;
		private TimeSpan _realTimeTolerance;
		private ITimeContext _platformTimeContext;

		protected override void Given()
		{
			_now = DateTime.UtcNow;
			_realTimeTolerance = TimeSpan.FromSeconds(1);
		}

		protected override void When()
		{
			_platformTimeContext = new PlatformTimeContext();
		}

		[Then]
		public void NowIsOriginalValue()
		{
			Assert.That(_platformTimeContext.Now, Is.LessThan(_now + _realTimeTolerance));
		}
	}
}